<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>随便打TCS系统</title>

<!-- Bootstrap -->
<link href="<%=basePath%>vendors/bootstrap/dist/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Font Awesome -->
<link
	href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
	rel="stylesheet">
<!-- NProgress -->
<link href="<%=basePath%>vendors/nprogress/nprogress.css"
	rel="stylesheet">
<!-- iCheck -->
<link href="<%=basePath%>vendors/iCheck/skins/flat/green.css"
	rel="stylesheet">

<!-- bootstrap-progressbar -->
<link
	href="<%=basePath%>vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css"
	rel="stylesheet">
<!-- JQVMap -->
<link href="<%=basePath%>vendors/jqvmap/dist/jqvmap.min.css"
	rel="stylesheet" />
<!-- bootstrap-daterangepicker -->
<link
	href="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.css"
	rel="stylesheet">

<!-- Custom Theme Style -->
<link href="<%=basePath%>build/css/custom.min.css" rel="stylesheet">
<script src="<%=basePath%>vendors/kindeditor/kindeditor-all-min.js"></script>
<script src="<%=basePath%>vendors/kindeditor/lang/zh-CN.js"></script>
</head>

<body class="nav-md">
	<div class="container body">
		<div class="main_container">
			<div class="col-md-3 left_col">
				<div class="left_col scroll-view">
					<div class="clearfix"></div>
					<br />
				</div>
			</div>
			<!-- page content -->
			<div class="right_col" role="main">
				<div class="">
					<div class="row">
						<div class="clearfix"></div>
						<div class="col-md-12 col-sm-12 col-xs-12">
							<div class="x_panel">
								<div class="x_content">
									<form name="myForm" class="form-horizontal form-label-left" novalidate 
						                  method= "post" enctype ="multipart/form-data" id="formUpload" > 
						                <span class="section">新闻设置</span>
						                <div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">头条<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="toutiao" disabled>
														<option value="1" <c:if test="${newsAllocation.toutiao == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.toutiao == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">社会<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="shehui">
														<option value="1" <c:if test="${newsAllocation.shehui == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.shehui == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">国内<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="guonei">
														<option value="1" <c:if test="${newsAllocation.guonei == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.guonei == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">国际<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="guoji">
														<option value="1" <c:if test="${newsAllocation.guoji == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.guoji == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">娱乐<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="yule">
														<option value="1" <c:if test="${newsAllocation.yule == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.yule == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">体育<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="tiyu">
														<option value="1" <c:if test="${newsAllocation.tiyu == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.tiyu == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">军事<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="junshi">
														<option value="1" <c:if test="${newsAllocation.junshi == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.junshi == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">科技<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="keji">
														<option value="1" <c:if test="${newsAllocation.keji == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.keji == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">财经<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="caijing">
														<option value="1" <c:if test="${newsAllocation.caijing == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.caijing == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">时尚<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="shishang">
														<option value="1" <c:if test="${newsAllocation.shishang == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.shishang == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">电竞<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="youxi">
														<option value="1" <c:if test="${newsAllocation.youxi == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.youxi == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">汽车<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="qiche">
														<option value="1" <c:if test="${newsAllocation.qiche == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.qiche == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">笑话<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="xiaohua">
														<option value="1" <c:if test="${newsAllocation.xiaohua == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.xiaohua == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">健康<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="jiankang">
														<option value="1" <c:if test="${newsAllocation.jiankang == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.jiankang == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">生活<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="jiaju">
														<option value="1" <c:if test="${newsAllocation.jiaju == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.jiaju == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">星座<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="xingzuo">
														<option value="1" <c:if test="${newsAllocation.xingzuo == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.xingzuo == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">历史<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="lishi">
														<option value="1" <c:if test="${newsAllocation.lishi == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.lishi == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name" id="isalipayLaybel">杂谈<span
												class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<select class="form-control" id="zatan">
														<option value="1" <c:if test="${newsAllocation.zatan == 1}">selected</c:if>>添加</option>
														<option value="0" <c:if test="${newsAllocation.zatan == 0}">selected</c:if>>不添加</option>
												</select>
											</div>
										</div>
										<div class="form-group">
											<div class="col-md-12 col-sm-12 col-xs-12 col-md-offset-3">
												<a type="submit" class="btn btn-primary"
													href="javascript:void(0)"
													onclick="history.back(-1);">返回</a>
												<input id="revise" type="button" class="btn btn-success"
													value="修改" onclick="ajaxPost()">
												<a id="grab" type="button" class="btn btn-default">新闻抓取频次</a>
											</div>
										</div>
										<div class="item form-group" id="intodiv" style="display: none">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">频次/小时<span class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input class="form-control col-md-7 col-xs-12" name="name"
													required="required" type="text" value="${newsAllocation.inserttime}"
													id="inserttime">
											</div>
										</div>
										<div class="form-group" id="intosubmit" style="display: none">
											<div class="col-md-12 col-sm-12 col-xs-12 col-md-offset-3">
												<input id="revise" type="button" class="btn btn-success"
													value="修改" onclick="ajaxPost()">
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<script src="<%=basePath%>vendors/jquery/dist/jquery.min.js"></script>
			<script>
			$(document).ready(function(e) {
				$("#grab").click(function(){
				    $("#intodiv").toggle();
				    $("#intosubmit").toggle();
				});
			});
			</script>
			<script type="text/javascript">
				// ajax 对象
				function ajaxObject() {
					var xmlHttp;
					try {
						// Firefox, Opera 8.0+, Safari
						xmlHttp = new XMLHttpRequest();
					} catch (e) {
						// Internet Explorer
						try {
							xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
						} catch (e) {
							try {
								xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
							} catch (e) {
								alert("您的浏览器不支持AJAX！");
								return false;
							}
						}
					}
					return xmlHttp;
				}
			
			
				// ajax post请求：
				function ajaxPost() {
					var shehui = $("#shehui").find("option:selected").val();
					var guonei = $("#guonei").find("option:selected").val();
					var guoji = $("#guoji").find("option:selected").val();
					var yule = $("#yule").find("option:selected").val();
					var tiyu = $("#tiyu").find("option:selected").val();
					var junshi = $("#junshi").find("option:selected").val();
					var keji = $("#keji").find("option:selected").val();
					var caijing = $("#caijing").find("option:selected").val();
					var shishang = $("#shishang").find("option:selected").val();
					var youxi = $("#youxi").find("option:selected").val();
					var qiche = $("#qiche").find("option:selected").val();
					var xiaohua = $("#xiaohua").find("option:selected").val();
					var jiankang = $("#jiankang").find("option:selected").val();
					var jiaju = $("#jiaju").find("option:selected").val();
					var lishi = $("#lishi").find("option:selected").val();
					var xingzuo = $("#xingzuo").find("option:selected").val();
					var zatan = $("#zatan").find("option:selected").val();
					var inserttime = $("#inserttime").val();
					var ajax = ajaxObject();
					ajax.open("post", "updateNewsAllocation?shehui=" + shehui +
						"&guonei=" + guonei +
						"&guoji=" + guoji +
						"&yule=" + yule +
						"&tiyu=" + tiyu +
						"&junshi=" + junshi +
						"&keji=" + keji +
						"&caijing=" + caijing +
						"&shishang=" + shishang +
						"&youxi=" + youxi +
						"&qiche=" + qiche +
						"&xiaohua=" + xiaohua +
						"&jiaju=" + jiaju +
						"&lishi=" + lishi +
						"&xingzuo=" + xingzuo +
						"&zatan=" + zatan +
						"&inserttime=" + inserttime +
						"&jiankang=" + jiankang, false);
					ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					ajax.onreadystatechange = function() {
						if (ajax.readyState == 4) {
							if (ajax.status == 200) {
								var result = ajax.responseText;
								if (result == "success") {
									//请求成功
									alert("修改成功");
									location.href = "content_xinwenfenlei";
								} else {
									//创建失败
									alert(result);
								}
							} else if (ajax.status == 0) {
								//请求失败
								alert("您使用的火狐浏览器不支持本次操作，请更换浏览器重试");
							} else {
								//请求失败
								alert("请求终止，请检查操作或联系客服咨询" + ajax.status);
							}
						} else {
						}
					};
					ajax.send();
			
				}
			</script>
		</div>
	</div>
	<!-- jQuery -->
	<script src="<%=basePath%>vendors/jquery/dist/jquery.min.js"></script>
	<!-- Bootstrap -->
	<script src="<%=basePath%>vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	<!-- FastClick -->
	<script src="<%=basePath%>vendors/fastclick/lib/fastclick.js"></script>
	<!-- NProgress -->
	<script src="<%=basePath%>vendors/nprogress/nprogress.js"></script>
	<!-- bootstrap-daterangepicker -->
	<script src="<%=basePath%>vendors/moment/min/moment.min.js"></script>
	<script
		src="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
	<!-- Chart.js -->
	<script src="<%=basePath%>vendors/Chart.js/dist/Chart.min.js"></script>

	<!-- Custom Theme Scripts -->
	<script src="<%=basePath%>build/js/custom.min.js"></script>
</body>
</html>